import {defineConfig} from 'vitepress'
import {SearchPlugin} from "vitepress-plugin-search"

// https://vitepress.dev/reference/site-config
export default defineConfig({
    title: "程俊龙的个人博客",
    description: "个人技术、生活、成长记录",
    head: [
        [
            "link",
            {
                rel: "apple-touch-icon",
                sizes: "180x180",
                href: "/logo.png",
            },
        ],
        [
            "link",
            {
                rel: "icon",
                type: "image/png",
                sizes: "32x32",
                href: "/logo-big.jpg",
            },
        ],
        [
            "link",
            {
                rel: "icon",
                type: "image/png",
                sizes: "16x16",
                href: "/logo.png",
            },
        ],
        // ["link", {rel: "shortcut icon", href: "/favicon-16x16.ico"}],
        // 用于渲染外部图片链接
        ["meta", {name: "referrer", content: "no-referrer"}]

    ],
    outDir: "dist",
    srcDir: "src",
    themeConfig: {
        logo: "/logo-big.jpg",
        // https://vitepress.dev/reference/default-theme-config 导航栏
        nav: [
            {text: '首页', link: '/'},
            {text: 'Examples', link: '/markdown-examples'},
            // {text: '个人成长', link: '/api-examples'},
            // {text: '个人简历', link: '/markdown-examples'}
        ],
        // 侧边栏
        sidebar: [
            {
                text: '关于我',
                // collapsed: true,
                items: [
                    {text: 'Markdown Examples', link: '/markdown-examples'},
                    {text: 'Runtime API Examples', link: '/api-examples'}
                ]
            },
            {
                text: '数据结构与算法',
                // collapsed: true,
                items: [
                    {text: '二叉树', link: '/数据结构与算法/二叉树'},
                    {text: '二叉搜索树', link: '/数据结构与算法/二叉搜索树'},
                    {text: '双指针解决链表问题', link: '/数据结构与算法/双指针解决链表问题'},
                    {text: '平衡二叉树', link: '/数据结构与算法/平衡二叉树'},
                    {text: '链表删除', link: '/数据结构与算法/链表删除'},
                ]
            },
            {
                text: '知识碎片',
                // collapsed: true,
                items: [
                    {text: 'Git 设置 ssh 远程连接', link: '/知识碎片/Git 设置 ssh 远程连接'},
                    {text: 'Promise', link: '/知识碎片/Promise'},
                ]
            }
        ],

        aside: true,

        // 社交媒体标签
        socialLinks: [
            {icon: 'github', link: 'https://github.com/feng-ye-cjl'}
        ],

        footer: {
            message: `欢迎来到我的个人网站`,
            copyright: `by  程俊龙`,
        },

        docFooter: {
            prev: "上一页",
            next: "下一页",
        },

        // https://vitepress.dev/zh/reference/default-theme-config#outline
        outline: {
            level: [1, 2, 3, 4],
            label: "页面导航",
        },

        // 最后更新时间
        // lastUpdated: {
        //     text: "最后更新于",
        //     formatOptions: {
        //         dateStyle: "short", // full
        //         timeStyle: "short", // medium
        //     },
        // },

        // 本地搜索配置
        search: {
            provider: "local",
            options: {
                miniSearch: {
                    options: {
                        /* ... */
                    },
                    searchOptions: {
                        /* ... */
                    },
                },
                translations: {
                    button: {
                        buttonText: "搜索文档",
                        buttonAriaLabel: "搜索文档",
                    },
                    modal: {
                        noResultsText: "没有找到结果",
                        resetButtonTitle: "清除搜索条件",
                        footer: {
                            selectText: "选择",
                            navigateText: "切换",
                            closeText: "关闭",
                        },
                    },
                },
            },
        },

        langMenuLabel: "多语言",
        returnToTopLabel: "回到顶部",
        sidebarMenuLabel: "菜单",
        darkModeSwitchLabel: "主题",
        lightModeSwitchTitle: "切换到浅色模式",
        darkModeSwitchTitle: "切换到深色模式",
    },
    theme: './.vitepress/theme',
    vite: {
        // https://cn.vitejs.dev/config/shared-options.html#publicdir  //
        publicDir: "../public", // 指定 public 目录路径 //
        plugins: [
            SearchPlugin({
                previewLength: 80, // 这个选项决定了搜索结果预览的长度，单位是字符数
                buttonLabel: "搜索", // 这个选项可以用来改变搜索按钮的标签
                placeholder: "搜索文档", // 这个选项可以用来设置搜索输入框的占位符
                allow: [], // 这是一个数组，你可以在这个数组中指定哪些页面可以被搜索
                ignore: [], // 这也是一个数组，你可以在这个数组中指定哪些页面不被搜索
            }),
        ],
    },
    cleanUrls: true,
})
